package com.sft360.kb.drawview;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;
import android.util.Log;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;


public class MainActivity extends AppCompatActivity {

    ArrayList<String> lists = new ArrayList<>();

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(new RCircleView(this));
        init();
        deleteData();
        deleteDataIterator();
        deleteDataIterator2();
        endData();
    }

    /**
     * 迭代器2
     */
    private void deleteDataIterator2() {
        for (Iterator iterator = lists.iterator();iterator.hasNext();){
            if ("测试1".equals(iterator.next())){
                iterator.remove();
            }
        }
    }
    /**
     * 迭代器1
     */
    private void deleteDataIterator() {
        Iterator iterator = lists.iterator();
        while (iterator.hasNext()){
            if ("测试2".equals(iterator.next())){
                iterator.remove();
            }
        }
    }

    private void endData() {
        Log.i("lists",""+lists.toString());
    }

    private void deleteData() {
        for (int i=0;i<lists.size();i++){
            if (lists.get(i).equals("测试1")){
                lists.remove(lists.get(i));
            }
        }

    }

    private void init() {
        lists.add("测试1");
        lists.add("测试2");
        lists.add("测试3");
        lists.add("测试1");
        lists.add("测试5");
        lists.add("测试6");
    }
}
